package com.ruoyi.system.mapper;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.system.domain.ProjectInfo;
import com.ruoyi.system.domain.summary.AnnualMetrics;
import com.ruoyi.system.domain.summary.ProjectSummary;
import com.ruoyi.system.domain.summary.Summary;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

/**
 * 项目Mapper接口
 * 
 * @author xuliang
 * @date 2024-03-29
 */
@Component(value = "ProjectInfoMapper")
public interface ProjectInfoMapper 
{

    /**
     * 查询项目
     * 
     * @param id 项目主键
     * @return 项目
     */
    public ProjectInfo selectProjectInfoById(Long id);

    /**
     * 查询项目列表
     * 
     * @param projectInfo 项目
     * @return 项目集合
     */
    public List<ProjectInfo> selectProjectInfoList(ProjectInfo projectInfo);

    /**
     * 新增项目
     * 
     * @param projectInfo 项目
     * @return 结果
     */
    public int insertProjectInfo(ProjectInfo projectInfo);

    /**
     * 修改项目
     * 
     * @param projectInfo 项目
     * @return 结果
     */
    public int updateProjectInfo(ProjectInfo projectInfo);

    /**
     * 删除项目
     * 
     * @param id 项目主键
     * @return 结果
     */
    public int deleteProjectInfoById(Long id);

    /**
     * 批量删除项目
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteProjectInfoByIds(Long[] ids);

    // 查询时更新项目
    public int updateProjectInfoBeforeGet(@Param("projectName") String projectName, @Param("projectCode") String projectCode);

    // 确认数量
    public int countProjectInfoByProjectCodeAndName(@Param("projectName") String projectName, @Param("projectCode") String projectCode);

    ProjectInfo selectProjectInfo(ProjectInfo projectInfo);

    int updateItemSummary(String projectCode);

    int updateLaborSummary(String projectCode);

    int updateDirectSummary(String projectCode);

    Summary selectItemSummary(String projectCode);

    Summary selectLaborSummary(String projectCode);

    Summary selectDirectSummary(String projectCode);

    int insertItemSummary(String projectCode);

    int insertLaborSummary(String projectCode);

    int insertDirectSummary(String projectCode);

    List<String> getProjectCodes(Integer areaId);

    int updateIndirectSummary(String projectCode);

    Summary selectIndirectSummary(String projectCode);

    int insertIndirectSummary(String projectCode);

    int insertProjectSummary(ProjectSummary projectSummary);

    int updateProjectSummary();

    List<ProjectSummary> selectProjectSummaryList(Integer areaId);

    int countProjectSummary(String projectCode);

    int checkProjectBeforeDelete(long id);

    Integer selectMaxNumber(String projectCode);

    LocalDateTime selectMaxTimeByProjectCodeAndNumber(@Param("projectCode") String projectCode, @Param("maxNumber") Integer maxNumber);

    int updateProjectNumber(@Param("DateNumber")String DateNumber,@Param("projectCode") String projectCode);

    boolean detailIsMax(@Param("projectCode") String projectCode, @Param("number") Integer number);

    int updateProjectSummaryByEntity(ProjectSummary projectSummary);

    List<String> getContractByAreaId(Integer areaId);

    List<String> getContractNameByAreaId(Integer areaId);

    String selectProjectCodeByName(String projectName);

    int checkContractByNameAndCode(@Param("projectName") String projectName, @Param("projectCode") String projectCode);

    boolean checkRoleByUserId(@Param("userId") long userId, @Param("roleIds") List<Long> roleIds);

    long selectNewestUserId();

    int insertProjectUser(@Param("projectCode") String projectCode, @Param("userId") long userId);

    String selectProjectNameByCode(String projectCode);

    String selectProjectCodeByUserId(long userId);

    List<Long> selectRoleIdsByUserId(long userId);

    BigDecimal selectProjectContractByName(String projectName);

    int insertAnnualMetrics(@Param("areaId") Integer areaId, @Param("dateNumber") String dateNumber);

    void updateAnnualMetrics();

    List<AnnualMetrics> selectAnnualMetricsList(String dateNumber);
}
